/*
 * mappings.h
 *
 *  Created on: Jun 16, 2011
 *      Author: jelle
 */

#ifndef MAPPINGS_H_
#define MAPPINGS_H_
#include "operations.h"

fp map[256] = {
  &NOP,
  &LDBCnn,
  &LDBCmA,
  &INCBC,
  &INCr_b,
  &DECr_b,
  &LDrn_b,
  &RLCA,
  &NOP, //TODO doesn't exist :(, SHOULD BE &LDmmSP
  &ADDHLBC,
  &LDABCm,
  &DECBC,
  &INCr_c,
  &DECr_c,
  &LDrn_c,
  &RRCA,


  &DJNZn,
  &LDDEnn,
  &LDDEmA,
  &INCDE,
  &INCr_d,
  &DECr_d,
  &LDrn_d,
  &RLA,
  &JRn,
  &ADDHLDE,
  &LDADEm,
  &DECDE,
  &INCr_e,
  &DECr_e,
  &LDrn_e,
  &RRA,


  &JRNZn,
  &LDHLnn,
  &LDHLIA,
  &INCHL,
  &INCr_h,
  &DECr_h,
  &LDrn_h,
  &XX,
  &JRZn,
  &ADDHLHL,
  &LDAHLI,
  &DECHL,
  &INCr_l,
  &DECr_l,
  &LDrn_l,
  &CPL,


  &JRNCn,
  &LDSPnn,
  &LDHLDA,
  &INCSP,
  &INCHLm,
  &DECHLm,
  &LDHLmn,
  &SCF,
  &JRCn,
  &ADDHLSP,
  &LDAHLD,
  &DECSP,
  &INCr_a,
  &DECr_a,
  &LDrn_a,
  &CCF,


  &LDrr_bb,
  &LDrr_bc,
  &LDrr_bd,
  &LDrr_be,
  &LDrr_bh,
  &LDrr_bl,
  &LDrHLm_b,
  &LDrr_ba,
  &LDrr_cb,
  &LDrr_cc,
  &LDrr_cd,
  &LDrr_ce,
  &LDrr_ch,
  &LDrr_cl,
  &LDrHLm_c,
  &LDrr_ca,


  &LDrr_db,
  &LDrr_dc,
  &LDrr_dd,
  &LDrr_de,
  &LDrr_dh,
  &LDrr_dl,
  &LDrHLm_d,
  &LDrr_da,
  &LDrr_eb,
  &LDrr_ec,
  &LDrr_ed,
  &LDrr_ee,
  &LDrr_eh,
  &LDrr_el,
  &LDrHLm_e,
  &LDrr_ea,


  &LDrr_hb,
  &LDrr_hc,
  &LDrr_hd,
  &LDrr_he,
  &LDrr_hh,
  &LDrr_hl,
  &LDrHLm_h,
  &LDrr_ha,
  &LDrr_lb,
  &LDrr_lc,
  &LDrr_ld,
  &LDrr_le,
  &LDrr_lh,
  &LDrr_ll,
  &LDrHLm_l,
  &LDrr_la,


  &LDHLmr_b,
  &LDHLmr_c,
  &LDHLmr_d,
  &LDHLmr_e,
  &LDHLmr_h,
  &LDHLmr_l,
  &HALT,
  &LDHLmr_a,
  &LDrr_ab,
  &LDrr_ac,
  &LDrr_ad,
  &LDrr_ae,
  &LDrr_ah,
  &LDrr_al,
  &LDrHLm_a,
  &LDrr_aa,


  &ADDr_b,
  &ADDr_c,
  &ADDr_d,
  &ADDr_e,
  &ADDr_h,
  &ADDr_l,
  &ADDHL,
  &ADDr_a,
  &ADCr_b,
  &ADCr_c,
  &ADCr_d,
  &ADCr_e,
  &ADCr_h,
  &ADCr_l,
  &ADCHL,
  &ADCr_a,


  &SUBr_b,
  &SUBr_c,
  &SUBr_d,
  &SUBr_e,
  &SUBr_h,
  &SUBr_l,
  &SUBHL,
  &SUBr_a,
  &SBCr_b,
  &SBCr_c,
  &SBCr_d,
  &SBCr_e,
  &SBCr_h,
  &SBCr_l,
  &SBCHL,
  &SBCr_a,


  &ANDr_b,
  &ANDr_c,
  &ANDr_d,
  &ANDr_e,
  &ANDr_h,
  &ANDr_l,
  &ANDHL,
  &ANDr_a,
  &XORr_b,
  &XORr_c,
  &XORr_d,
  &XORr_e,
  &XORr_h,
  &XORr_l,
  &XORHL,
  &XORr_a,


  &ORr_b,
  &ORr_c,
  &ORr_d,
  &ORr_e,
  &ORr_h,
  &ORr_l,
  &ORHL,
  &ORr_a,
  &CPr_b,
  &CPr_c,
  &CPr_d,
  &CPr_e,
  &CPr_h,
  &CPr_l,
  &CPHL,
  &CPr_a,


  &RETNZ,
  &POPBC,
  &JPNZnn,
  &JPnn,
  &CALLNZnn,
  &PUSHBC,
  &ADDn,
  &RST00,
  &RETZ,
  &RET,
  &JPZnn,
  &MAPcb,
  &CALLZnn,
  &CALLnn,
  &ADCn,
  &RST08,


  &RETNC,
  &POPDE,
  &JPNCnn,
  &XX,
  &CALLNCnn,
  &PUSHDE,
  &SUBn,
  &RST10,
  &RETC,
  &RETI,
  &JPCnn,
  &XX,
  &CALLCnn,
  &XX,
  &SBCn,
  &RST18,


  &LDIOnA,
  &POPHL,
  &LDIOCA,
  &XX,
  &XX,
  &PUSHHL,
  &ANDn,
  &RST20,
  &ADDSPn,
  &JPHL,
  &LDmmA,
  &XX,
  &XX,
  &XX,
  &ORn,
  &RST28,


  &LDAIOn,
  &POPAF,
  &LDAIOC,
  &DI,
  &XX,
  &PUSHAF,
  &XORn,
  &RST30,
  &LDHLSPn,
  &XX,
  &LDAmm,
  &EI,
  &XX,
  &XX,
  &CPn,
  &RST38
};



fp cbmap[256] = {
  &RLCr_b,
  &RLCr_c,
  &RLCr_d,
  &RLCr_e,
  &RLCr_h,
  &RLCr_l,
  &RLCHL,
  &RLCr_a,
  &RRCr_b,
  &RRCr_c,
  &RRCr_d,
  &RRCr_e,
  &RRCr_h,
  &RRCr_l,
  &RRCHL,
  &RRCr_a,


  &RLr_b,
  &RLr_c,
  &RLr_d,
  &RLr_e,
  &RLr_h,
  &RLr_l,
  &RLHL,
  &RLr_a,
  &RRr_b,
  &RRr_c,
  &RRr_d,
  &RRr_e,
  &RRr_h,
  &RRr_l,
  &RRHL,
  &RRr_a,


  &SLAr_b,
  &SLAr_c,
  &SLAr_d,
  &SLAr_e,
  &SLAr_h,
  &SLAr_l,
  &XX,
  &SLAr_a,
  &SRAr_b,
  &SRAr_c,
  &SRAr_d,
  &SRAr_e,
  &SRAr_h,
  &SRAr_l,
  &XX,
  &SRAr_a,


  &SWAPr_b,
  &SWAPr_c,
  &SWAPr_d,
  &SWAPr_e,
  &SWAPr_h,
  &SWAPr_l,
  &XX,
  &SWAPr_a,
  &SRLr_b,
  &SRLr_c,
  &SRLr_d,
  &SRLr_e,
  &SRLr_h,
  &SRLr_l,
  &XX,
  &SRLr_a,


  &BIT0b,
  &BIT0c,
  &BIT0d,
  &BIT0e,
  &BIT0h,
  &BIT0l,
  &BIT0m,
  &BIT0a,
  &BIT1b,
  &BIT1c,
  &BIT1d,
  &BIT1e,
  &BIT1h,
  &BIT1l,
  &BIT1m,
  &BIT1a,


  &BIT2b,
  &BIT2c,
  &BIT2d,
  &BIT2e,
  &BIT2h,
  &BIT2l,
  &BIT2m,
  &BIT2a,
  &BIT3b,
  &BIT3c,
  &BIT3d,
  &BIT3e,
  &BIT3h,
  &BIT3l,
  &BIT3m,
  &BIT3a,


  &BIT4b,
  &BIT4c,
  &BIT4d,
  &BIT4e,
  &BIT4h,
  &BIT4l,
  &BIT4m,
  &BIT4a,
  &BIT5b,
  &BIT5c,
  &BIT5d,
  &BIT5e,
  &BIT5h,
  &BIT5l,
  &BIT5m,
  &BIT5a,


  &BIT6b,
  &BIT6c,
  &BIT6d,
  &BIT6e,
  &BIT6h,
  &BIT6l,
  &BIT6m,
  &BIT6a,
  &BIT7b,
  &BIT7c,
  &BIT7d,
  &BIT7e,
  &BIT7h,
  &BIT7l,
  &BIT7m,
  &BIT7a,


  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,


  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,


  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,


  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,


  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,


  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,


  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,


  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX,
  &XX
};




#endif /* MAPPINGS_H_ */
